<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>套餐列表 </title>
    <meta name="Author" content="E-SHOP Team"/>
    <meta name="Copyright" content="E-SHOP"/>
    <link rel="icon" href="favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" type="text/css"
          href="${base}/res/plugins/kindeditor-4.1.10/themes/default/default.css?v=2014-05-21"/>
    <link href="${base}/res/css/common.css" rel="stylesheet" type="text/css"/>
    <% include("/WEB-INF/views/common/include.html"){}%>

    <!-- 百度编辑器 -->
    <script type="text/javascript" charset="utf-8" src="${base}/res/plugins/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="${base}/res/plugins/ueditor/ueditor.all.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="${base}/res/plugins/ueditor/lang/zh-cn/zh-cn.js"></script>

    <script type="text/javascript" src="${base}/res/plugins/kindeditor-4.1.10/kindeditor-min.js?v=2014-05-21"></script>
    <script type="text/javascript" src="${base}/res/plugins/kindeditor-4.1.10/lang/zh_CN.js?v=2014-05-21"></script>
    <script type="text/javascript" src="${base}/res/plugins/kindeditor-4.1.10/smimage.js"></script>
    <script type="text/javascript" src="${base}/res/plugins/hplus/js/plugins/layer/layer.min.js"></script>

    <script src="https://static.9hive.cn/global/vendor/layer/laydate/laydate.js"></script>
    <script src="https://static.9hive.cn/global/vendor/moment/moment.min.js"></script>
    <script src="https://static.9hive.cn/global/vendor/bootstrap-daterangepicker/daterangepicker.js"></script>
    <style type="text/css">

        *, :before, :after {
            -webkit-box-sizing: border-box;
            box-sizing: content-box;
        }
    </style>
    <script type="text/javascript">
        var ue = UE.getEditor('editor');//初始化
    </script>
    <%
    var isAdd = false;
    var isEdit = false;
    if(isEmpty(businessPackage.id)){
    isAdd = true;
    }else{
    isEdit = true;
    }%>
</head>
<body>
<div class="path">
    套餐管理 &raquo; <%if(isAdd){%>添加套餐<%}else{%>编辑套餐<%}%>
</div>
<form id="inputForm" class="am-form"
      action="<%if(isAdd){%>${base}/admin/businessPackage/save<%}else{%>${base}/admin/businessPackage/update<%}%>"
      method="post"
      onsubmit="return check()">
    <input type="hidden" name="businessPackage.id" value="${businessPackage.id!}"/>
    <table class="input tabContent">
        <tr>
            <th>
                套餐名称:
            </th>
            <td>
                <input type="text" name="businessPackage.name" id="businessPackageName" class="formText"
                       value="${businessPackage.name!}"/>
                <label class="requireField">*</label>
            </td>
        </tr>
        <tr>
            <th>
                开始日期:
            </th>
            <td>
                <input type="text" name="businessPackage.startDate" id="businessPackageStartDate" value="${businessPackage.startDate!}"
                       onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" class="formText"/>
                <label class="laydate-icon inline demoicon"></label>
                <label class="requireField">*</label>
            </td>
        </tr>
        <tr>
            <th>
                结束日期:
            </th>
            <td>
                <input type="text" name="businessPackage.endDate" id="businessPackageEndDate" class="formText" value="${businessPackage.endDate!}"
                       onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"/>
                <label class="laydate-icon inline demoicon"></label>
                <label class="requireField">*</label>
            </td>
        </tr>
        <tr>
            <th>
                套餐详情:
            </th>
            <td>
                <script id="editor" name="businessPackage.introduction" type="text/plain"
                        style="height:240px;width:80%">
                    ${businessPackage.introduction!}


                </script>
            </td>
        </tr>
    </table>
    <div class="buttonArea" style="margin-left: 165px;margin-top: 5px;">
        <input type="submit" id="submitbutton" class="button" value="确  定" hidefocus="true"/>&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" class="button" onclick="window.history.back(); return false;" value="返  回"
               hidefocus="true"/>
    </div>
</form>
</body>
<script>
    function check() {

        var businessPackageName = $("#businessPackageName").val();
        var businessPackageStartDate = $("#businessPackageStartDate").val();
        var businessPackageEndDate = $("#businessPackageEndDate").val();
        if (!businessPackageName) {
            layer.msg("请输入套餐名称!");
            return false;
        }

        if (!businessPackageStartDate) {
            layer.msg("请输入套餐开始日期");
            return false;
        }
        if (!businessPackageEndDate) {
            layer.msg("请输入套餐结束日期");
            return false;
        }
    }
    KindEditor.ready(function (K) {
        var editor = KindEditor.editorObj || K.editor({
                    themeType: 'simple',
                    allowFileManager: true,
                    uploadJson: '${base}/file/uploadfile?shopId=${shopId!}&type=k',
                    fileManagerJson: 'https://www3.weimob.com/resource/imageSingleManage?bid=11933&pid=5883'
                });

        $('#image_upload button.select_img').click(function(e){
            editor.loadPlugin('smimage', function(){
                editor.plugin.imageDialog({
                    imageUrl: $(e.target).parent().prev().val(),
                    showRemote: 1,//体验版 试用版 禁止上传网络图片 weijing.zhou
                    clickFn: function(url, title, width, height, border, align){
                        $(e.target).parent().prev().val(url);

                        if('image-single' == $(e.target).parent().prev().prev().attr('upload')){
                            $(e.target).parent().prev().prev().attr('src', url);
                            $(e.target).parent().prev().prev().attr('alt', url)
                        }

                        editor.hideDialog();
                    }
                });
            });
        });
    });
</script>
</html>